{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 99,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline  \n",
    "import random\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import math"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "metadata": {},
   "outputs": [],
   "source": [
    "nsteps = 1000\n",
    "rg = np.array(range(nsteps))\n",
    "velocity = np.zeros(nsteps)\n",
    "heading = np.zeros(nsteps)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 123,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7f08374c60b8>]"
      ]
     },
     "execution_count": 123,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAEbhJREFUeJzt3X+QXWV9x/H3Nz8BfxBCdjRNgoGa2lJGkK78GNrC1KJILfmjOIVxKioa24FRO8602E6l+p8zrb8qg2aU+mMErMBoSqkMVUZrWykbxBgSo0HFLMayAiaCENi93/5xT/C6JLl7d+/dc8+z79fMndxzzsPe79nn8tlzn/OccyMzkSSVZVHdBUiS+s9wl6QCGe6SVCDDXZIKZLhLUoEMd0kqkOEuSQUy3CWpQIa7JBVoSV0vvGrVqly/fn1dLy9JjbR169afZuZIt3a1hfv69esZGxur6+UlqZEi4oGZtHNYRpIKZLhLUoEMd0kqkOEuSQUy3CWpQIa7JBXIcJekAtU2z12SDuWnjx3g+rt+xORUq+5SBmZ0/Up+/ze6Xoc0J4a7pKFy27f38v47vgtARM3FDMifn/vrhrukheWJp6YAuO89r+I5y42o2XLMXdJQOTDZHo5ZtsR4mouu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PS6kPd74ZeB7wH8AK6v2QXvm0P3At2nPRqh9P2a57+cBt1bPTwL+F9gNfB5YXq0/qlreXW0/qe6657C/pwFjVV9/ATiu5H4G3gN8B9gOfAZYXmI/AzfQPq/wNO1PaJfPpl+BN1X7vxt442zr8QpVSSpQ04ZlJEkzYLhLUoEMd0kqkOEuSQUy3CWpQIa7JBXIcJekAhnuklSg/wfmugDUrOh2IgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "velocity[0] = 1.25\n",
    "heading[0] = 0\n",
    "\n",
    "change = np.cumsum(np.random.poisson(200, 5))\n",
    "#change_head = \n",
    "\n",
    "for i in range(1,1000):\n",
    "    velocity[i] = velocity[i-1]\n",
    "    heading[i] = heading[i-1]\n",
    "\n",
    "    if i in change:\n",
    "        velocity[i] += random.choice([-1,1]) * random.uniform(-0.5,0.5)\n",
    "        heading[i] += random.choice([-1,1]) * random.uniform(-math.pi/8,math.pi/8)\n",
    "plt.plot(velocity)\n",
    "plt.plot(heading)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 124,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7f0837419940>,\n",
       " <matplotlib.lines.Line2D at 0x7f0837419a90>]"
      ]
     },
     "execution_count": 124,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAElVJREFUeJzt3X2wXHV9x/H3N/cmAYHyYG41JoGLEHHQEaVXHoRpmbYoMg7MWFqhTkVkmrEjIzpOO9LOiDqdjk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NlczStK9Vb0NcCdwIsyc2u16CfAi6r7JbwWfwv8GdCppl8I/Cwzd1XTvdv0y+2tlm+v1m+bY4FtwN9X7ajrIuIQCt3PmbkF+BvgR8BWuvttPeXv5ymz3a8D299tC/fiRcShwJeA92Tmk73LsvunvIjhTRHxJuDRzFzfdC372ShwMnBtZr4G+AW/eqsOFLefjwTOp/tH7SXAITy/dXFA2N/7tW3hvgVY0TO9vJpXhIhYSDfYP5eZX65m/19ELK2WLwUerea3/bU4AzgvIv4XuIlua+YTwBERMfXD7b3b9MvtrZYfDjy+PwsekM3A5sy8s5q+mW7Yl7qffxf4QWZuy8ydwJfp7vvS9/OU2e7Xge3vtoX7XcDK6kr7IroXZtY0XNNAREQAnwY2ZObHehatAaaumF9Mtxc/Nf9t1VX304DtPW//hl5mXpGZyzNznO5+/HpmvhW4A7igWm369k69DhdU67fu7DYzfwJsiogTqlm/AzxAofuZbjvmtIh4QXWMT21v0fu5x2z3663A6yPiyOpdz+urebPX9AWIOVywOBf4PvAw8BdN1zPA7TqT7lu2e4C7q9u5dPuNtwMPAV8DjqrWD7ojhx4G7qU7GqHx7Zjjtp8F3FLdfynwHWAj8EVgcTX/oGp6Y7X8pU3XPY/tfTWwrtrXXwGOLHk/Ax8CvgfcB3wWWFzifgZupHtdYSfdd2iXzmW/Au+otn8jcMlc6/ETqpJUoLa1ZSRJM2C4S1KBDHdJKpDhLkkFMtwlqUCGuyQVyHCXpAIZ7pJUoP8H3IZVYsglcu8AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "def rect(row):\n",
    "    r = row[0]\n",
    "    theta = row[1]\n",
    "    x = r * math.cos(theta)\n",
    "    y = r * math.sin(theta)\n",
    "    return np.array([x,y])\n",
    "\n",
    "trajectory_polar = np.vstack((velocity,heading)).transpose()\n",
    "trajectory_cart = np.apply_along_axis(rect, 1, trajectory_polar)\n",
    "plt.plot(trajectory_cart)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
